@import './common/var.css';
@import "./mixins/ellipsis.css";

.van-coupon {
  &-list {
    height: 100%;
    position: relative;
    background-color: $background-color;

    &__top {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      z-index: 1;
      padding-right: 85px;
      box-sizing: border-box;
    }

    &__filed {
      margin: 10px 0;
      padding: 4px 10px;

      &::after {
        border-radius: 6px;
        border-color: #cacaca;
      }
    }

    &__exchange {
      top: 10px;
      right: 15px;
      height: 32px;
      line-height: 30px;
      position: absolute;
      border-radius: 2px;
    }

    &__list {
      max-height: 100%;
      overflow-y: auto;
      padding: 15px 0 60px;
      box-sizing: border-box;
      -webkit-overflow-scrolling: touch;

      h3 {
        color: $gray-dark;
        margin: 15px 0;
        font-size: 14px;
        font-weight: normal;
        position: relative;
        text-align: center;

        &::before,
        &::after {
          content: ' ';
          width: 45px;
          height: 1px;
          top: 50%;
          position: absolute;
          background-color: $gray-light;
        }

        &::before {
          left: 50%;
          margin-left: -95px;
        }

        &::after {
          right: 50%;
          margin-right: -95px;
        }
      }

      .van-coupon-item + h3 {
        margin-top: 30px;
      }
    }

    &--with-exchange {
      padding-top: 60px;
    }

    &__close {
      left: 0;
      bottom: 0;
      width: 100%;
      font-size: 15px;
      line-height: 45px;
      text-align: center;
      position: absolute;
      background-color: $white;

      &:active {
        background-color: $active-color;
      }
    }

    &__empty {
      padding-top: 100px;
      text-align: center;

      p {
        color: $gray-dark;
        margin: 15px 0;
        font-size: 14px;
        line-height: 20px;
      }

      img {
        width: 80px;
        height: 84px;
      }
    }
  }

  &-item {
    display: flex;
    height: 100px;
    margin: 0 15px 10px;

    &__head {
      display: flex;
      height: 100%;
      min-width: 126px;
    }

    &__lines {
      height: 100%;
      min-width: 18px;
      background: url('') no-repeat;
      background-size: 18px 100px;
    }

    &__gradient {
      flex: 1;
      color: $white;
      display: flex;
      margin-left: -1px; /* hack for flex space */
      text-align: center;
      padding-right: 16px;
      flex-direction: column;
      justify-content: center;
      background-image: linear-gradient(45deg, #ff6868, #ff8c8c);

      h2 {
        font-size: 22px;
        font-weight: normal;
        margin: 0 0 10px;

        span {
          font-size: 16px;
        }
      }

      p {
        margin: 0;
        font-size: 14px;
        font-weight: 300;
        max-width: 90px;
        @mixin ellipsis;
      }
    }

    &__body {
      flex: 1;
      height: 100%;
      display: flex;
      padding: 0 15px;
      overflow: hidden;
      position: relative;
      background-color: $white;
      flex-direction: column;
      justify-content: center;
      border-radius: 0 4px 4px 0;

      h2 {
        margin: 0;
        opacity: .8;
        font-size: 16px;
        font-weight: normal;
      }

      p,
      span {
        color: $gray-dark;
        font-size: 12px;
        margin: 5px 0 0;
      }

      p,
      h2,
      span {
        line-height: 1.4;
        @mixin ellipsis;
      }
    }

    &__corner {
      position: absolute;
      top: 0;
      right: 0;
      width: 0;
      height: 0;
      border-style: solid;
      border-width: 18px 19px;
      border-radius: 0 4px 0 0;
      border-color: $red $red transparent transparent;

      .van-icon {
        position: absolute;
        top: -13px;
        right: -13px;
        color: $white;
        font-size: 12px;
        
        &::before {
          font-weight: bold;
        }
      }
    }

    &:active {
      .van-coupon-item__body {
        background-color: $active-color;
      }
    }

    &--disabled {
      .van-coupon-item__lines {
        background-image: url('');
      }

      .van-coupon-item__gradient {
        background-image: linear-gradient(45deg, #a4a9b2, #b7bcc3);
      }

      &:active {
        .van-coupon-item__body {
          background: $white;
        }
      }
    }
  }
}
